﻿using MediatR;
using RBAC.MaHaiBo.API.Application.Command.DeepProcessingCommand;
using RBAC.MaHaiBo.Service.TraceabilityService;

namespace RBAC.MaHaiBo.API.Application.CommandHandlers.DeepProcessingHandler
{
    public class updAdditiveCommandHandler:IRequestHandler<updAdditiveCommand,int>
    {
        /// <summary>
        /// 深加工服务层
        /// </summary>
        IDeepProcessingService service;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="service">深加工服务层</param>
        public updAdditiveCommandHandler(IDeepProcessingService service)
        {
            this.service = service;
        }

        public async Task<int> Handle(updAdditiveCommand request, CancellationToken cancellationToken)
        {
            return await service.updAdditive(new Entity.Traceability.Additive()
            {
                Additiveid = request.Additiveid,
                LOT = request.LOT,
                UpdName = request.UpdName,
                UpdTime = request.UpdTime,
            });
        }
    }
}
